<template>
	<view class="textBox">
		<view v-if="props.text.length>12">
			<view class="content" v-if="isOpen">
				<text>{{props.text}}</text>
				<text class="btn blue" @click="isOpen=false">收起</text>
			</view>
			<view class="content" v-else>
				<text>{{props.text.substr(0,12)}}...</text>
				<text class="btn blue" @click="isOpen=true">更多</text>
			</view>
		</view>
		<view v-else class="content">{{props.text}}</view>
	</view>
</template>

<script lang="ts" setup>
import { ref } from 'vue'
const props = defineProps({
	text: {
		type: String,
		default: () => ''
	}
})

const isOpen = ref(false)
</script>

<style lang="scss" scoped>
.content{
	font-size: 30rpx;
	line-height: 38rpx;
	word-break: break-all;
}
.btn{
	font-size: 28rpx;
	margin-left: 12rpx;
}
</style>